import time
from selenium.webdriver.common.by import By
from common.base import Base
from common.functions import open_browser


class LoginPage(Base):
    login_url = "http://139.129.26.163/user.php"

    def login_button(self):
        self.click((By.XPATH, "//font[@id='ECS_MEMBERZONE']/a[1]"))

    def input_username(self, username):
        self.send_keys((By.NAME, "username"), username)

    def input_password(self, password):
        self.send_keys((By.NAME, "password"), password)

    def remember(self):
        self.click((By.ID, "remember"))

    def login(self):
        self.click((By.CLASS_NAME, "us_Submit"))


if __name__ == "__main__":
    browser = open_browser("chrome")
    login = LoginPage(browser)
    login.get("https://ecshop.test2.shopex123.com/user.php")
    time.sleep(2)
    # login.input_username("abcd8888")
    # login.input_password("ecshop12")
    # login.remember()
    # login.login()
    # login.quit()
